import pandas as pd
from urllib.parse import unquote_plus
import requests
import re
import json

def qc():
    df = pd.read_excel('petpochitto中文(1).xls')
    df.drop_duplicates(subset=['pid'], keep='first', inplace=True)
    df.to_excel('pet.xlsx')


def url():
    url = 'https://descnew.taobao.com/i3/630/960/630965920994/TB1NJTCv_M11u4jSZPx8quhcXla.desc%7Cvar%5Edesc%3Bsign%5E272bae0f26e2141a6085572461e5b7e9%3Blang%5Egbk%3Bt%5E1623406229'
    print(unquote_plus(url))


def info():
    url = 'https://detail.tmall.hk/hk/item.htm?spm=a220o.1000855.0.da321h.5d66540b4wvwCs&id=624976532513'
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36"
    }
    cont = requests.get(url, headers=headers)
    cont.encoding = 'gbk'

    con = re.findall('TShop.Setup\((.+?)\);', cont.text, re.S | re.M)[-1]
    print(json.loads(con))


if __name__ == '__main__':
    info()
